package cc.catface.api.biz;

import cc.catface.common.aspect.NetLog;
import cc.catface.common.output.Result;
import cc.catface.dao.base.CommonINDTO;
import cc.catface.dao.biz.ad.AdChannel;
import cc.catface.dao.biz.ad.dto.ListLabelChannelINDTO;
import cc.catface.dao.biz.ad.dto.ListLabelChannelOUTDTO;
import cc.catface.service.AdChannelServiceImpl;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@ApiSupport(order = 10)
@Api(tags = "[ad]标签频道")
@RestController
@RequestMapping("ad/channel")
public class AdChannelController {
    @Autowired
    private AdChannelServiceImpl adChannelService;

    @ApiOperationSupport(order = 10)
    @NetLog("所有标签和频道")
    @ApiOperation(value = "所有标签和频道=开发")
    @ApiResponses(@ApiResponse(code = 200, message = "Success", response = ListLabelChannelOUTDTO.class))
    @PostMapping("listLabelChannel")
    public Result<List<ListLabelChannelOUTDTO>> listLabelChannel(@RequestBody ListLabelChannelINDTO in) {
        return adChannelService.listLabelChannel(in);
    }

    @ApiOperationSupport(order = 20)
    @NetLog("所有频道")
    @ApiOperation(value = "所有频道=开发")
    @ApiResponses(@ApiResponse(code = 200, message = "Success", response = AdChannel.class))
    @PostMapping("listChannel")
    public Result<List<AdChannel>> listChannel(@RequestBody CommonINDTO in) {
        return adChannelService.listChannel(in);
    }

}
